package com.zealfi.example.test.rabbitmq.amqp.consumer;

import com.rabbitmq.client.Channel;

import com.zealfi.example.test.rabbitmq.base.BaseConsumer;
import com.zealfi.example.test.rabbitmq.pojo.MemberPojo;
import com.zealfi.example.test.rabbitmq.util.JsonTool;
import org.springframework.amqp.core.Message;
import org.springframework.stereotype.Component;

/**
 * @功能:【LoanApplyMQConsumer 申请消费者】
 * @作者:代守诚
 * @日期:2018/10/19
 * @时间:17:04
 */
@Component
public class LoanApplyMQConsumer extends BaseConsumer {


    @Override
    protected void processExceptionMessage(Message message, Channel channel) throws Exception {
        channel.basicReject(message.getMessageProperties().getDeliveryTag(), false);
    }

    @Override
    protected void processMessage(Message message) {
        //处理自身的业务逻辑
        System.err.println("************消费者开始处理业务逻辑***************");
        MemberPojo memberPojo = fromMessage(message, MemberPojo.class);
        System.err.println("**********" + JsonTool.getJsonString(fromMessage(message, MemberPojo.class)));
    }
}
